<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增试卷')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-zrPaper-add">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">试卷名字：</label>
                    <div class="col-sm-8">
                        <input name="paperName" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <!--<div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">总分：</label>
                    <div class="col-sm-8">
                        <input name="paperSum" class="form-control" type="text">
                    </div>
                </div>
            </div>-->
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">及格分数：</label>
                    <div class="col-sm-8">
                        <input name="paperPass" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">选题：</label>
                    <div class="col-sm-8">
                        <select id="listId" class="form-control select2-multiple" multiple>
                            <option th:each="dict : ${list}" th:text="${dict.title}" th:value="${dict.id}"></option>
                        </select>
                    </div>
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var prefix = ctx + "ziran/zrPaper"
        $("#form-zrPaper-add").validate({
            focusCleanup: true
        });

        function submitHandler() {

            if ($.validate.form()) {
                var data = $("#form-zrPaper-add").serializeArray();
                var listId = $.form.selectSelects("listId");
                data.push({"name": "listId", "value": listId});
                $.operate.saveTab(prefix + "/add", data);
            }
        }
    </script>
</body>
</html>